package com.caigou.modules.info.adapter

import com.caigou.comm.base.utils.ImageLoader
import com.caigou.modules.info.R
import com.caigou.modules.info.bean.InfoItemBean
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder

/**
 * @author #Suyghur.
 * Created on 2021/11/20
 */
class MyCollectedItemAdapter(dataset: MutableList<InfoItemBean>) :
    BaseQuickAdapter<InfoItemBean, BaseViewHolder>(R.layout.item_my_collected_list, dataset),
    LoadMoreModule {
    override fun convert(holder: BaseViewHolder, item: InfoItemBean) {
        val type = when (item.type) {
            1 -> "港彩"
            2 -> "澳彩"
            3 -> "新彩"
            4 -> "台彩"
            else -> ""
        }
        holder.setText(R.id.item_my_collected_tv_cover_type, type)
        ImageLoader.load(context, item.cover, holder.getView(R.id.item_my_collected_iv_cover))
        holder.setText(R.id.item_my_collected_tv_cover_num, "共${item.imgs.size}张")
        holder.setText(R.id.item_my_collected_tv_title, item.title)
        holder.setText(R.id.item_my_collected_tv_desc, item.content)
        holder.setText(R.id.my_collected_tv_collected_time, "收藏时间：${item.createTime}")
    }
}